package com.sunny.service;

import com.sunny.service.v1.RpcProxyServer;
import com.sunny.service.v2.SpringConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Hello world!
 */
public class App {
    public static void main(String[] args) {
//        v1();
        v2();
    }

    public static void v1() {
        IHelloService helloService = new HelloServiceImpl();

        RpcProxyServer rpcProxyServer = new RpcProxyServer();
        //发布服务
        rpcProxyServer.publish(helloService, 8080);
    }

    public static void v2() {
        //通过注解方式启动spring容器
        ApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
        ((AnnotationConfigApplicationContext)applicationContext).start();
    }
}
